import request from '@/utils/request'

// 查询任务列表
export function listTask(query) {
  return request({
    url: '/task/task/list',
    method: 'get',
    params: query
  })
}

// 查询精选任务列表
export function listTaskFeatured(query) {
  return request({
    url: '/task/task/listFeatured',
    method: 'get',
    params: query
  })
}

// 查询任务详细
export function getTask(id) {
  return request({
    url: '/task/task/' + id,
    method: 'get'
  })
}

// 新增任务
export function addTask(data) {
  return request({
    url: '/task/task',
    method: 'post',
    data: data
  })
}

// 修改任务
export function updateTask(data) {
  return request({
    url: '/task/task',
    method: 'put',
    data: data
  })
}

// 删除任务
export function delTask(id) {
  return request({
    url: '/task/task/' + id,
    method: 'delete'
  })
}

// 审核任务
export function reviewTask(data) {
  return request({
    url: '/task/task/review',
    method: 'POST',
    data: data
  })
}

// 标记精选
export function markFeatured(taskId) {
  return request({
    url: '/task/task/markFeatured/' + taskId,
    method: 'PUT'
  })
}

// 取消精选
export function cancelFeatured(taskId) {
  return request({
    url: '/task/task/cancelFeatured/' + taskId,
    method: 'PUT'
  })
}

// 标记置顶
export function markTop(taskId) {
  return request({
    url: '/task/task/markTop/' + taskId,
    method: 'PUT'
  })
}

// 取消置顶
export function cancelTop(taskId) {
  return request({
    url: '/task/task/cancelTop/' + taskId,
    method: 'PUT'
  })
}

// 查询任务字典
export function getTaskDicts() {
  return request({
    url: '/task/task/getTaskDicts',
    method: 'GET'
  })
}
